﻿using UnityEditor;
using UnityEngine;
namespace LitBT
{
    /// <summary>
    /// 自定义行为树面板
    /// </summary>
    [CustomEditor(typeof(BehaviourTree))]
    public class BehaviourTreeInespector : Editor
    {
        public override void OnInspectorGUI()
        {
            //base.OnInspectorGUI();
            OpenGraphBtn(target as BehaviourTree);
        }

        /// <summary>
        /// 打开行为树的图
        /// </summary>
        private void OpenGraphBtn(BehaviourTree tree)
        {
            if (GUILayout.Button("查看行为树"))
            {
                var window = EditorWindow.GetWindow<BehaviourTreeEditor>();
                window.ShowTreeGraph(tree);
            }
        }
    }
}